import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ElderOutstandingFeesVO, ElderOutstandingFeesForm, ElderOutstandingFeesQuery } from '@/api/nursing/elderOutstandingFees/types';

/**
 * 查询欠费记录列表
 * @param query
 * @returns {*}
 */

export const listElderOutstandingFees = (query?: ElderOutstandingFeesQuery): AxiosPromise<ElderOutstandingFeesVO[]> => {
  return request({
    url: '/nursing/elderOutstandingFees/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询欠费记录详细
 * @param recordId
 */
export const getElderOutstandingFees = (recordId: string | number): AxiosPromise<ElderOutstandingFeesVO> => {
  return request({
    url: '/nursing/elderOutstandingFees/' + recordId,
    method: 'get'
  });
};

/**
 * 新增欠费记录
 * @param data
 */
export const addElderOutstandingFees = (data: ElderOutstandingFeesForm) => {
  return request({
    url: '/nursing/elderOutstandingFees',
    method: 'post',
    data: data
  });
};

/**
 * 修改欠费记录
 * @param data
 */
export const updateElderOutstandingFees = (data: ElderOutstandingFeesForm) => {
  return request({
    url: '/nursing/elderOutstandingFees',
    method: 'put',
    data: data
  });
};

/**
 * 删除欠费记录
 * @param recordId
 */
export const delElderOutstandingFees = (recordId: string | number | Array<string | number>) => {
  return request({
    url: '/nursing/elderOutstandingFees/' + recordId,
    method: 'delete'
  });
};
